//
//  QLTabBarController.swift
//  QLadder
//
//  Created by TonyHan on 2017/11/16.
//  Copyright © 2017年 TonyHan All rights reserved.
//

import UIKit

class QLTabBarController: UITabBarController {

    let images = [["browser", "browser_selected"],
                  ["server", "server_selected"],
                  ["mine", "mine_selected"]
                  ]
    let titles = ["浏览器", "服务器", "我的"]
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let backItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
        navigationItem.backBarButtonItem = backItem
        
        //自定义tabbar的item
        for (index, item) in (self.tabBar.items?.enumerated())! {
            item.image = UIImage(named: images[index][0])?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
            item.selectedImage = UIImage(named: images[index][1])?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
            item.title = titles[index];
        }
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.selectedIndex = 1
    }
}
